home *** CD-ROM | disk | FTP | other *** search
- this is libiconv 1.4
-
- I've ported it with gcc and it's a compiled with -noixemul
- so it doesn't require ixemul.library
-
- I've added 2 things to the library
-
- 1) a function called get_locale_charset();
- this function requires
- either of these vars
- 1) LC_ALL
- 2) LC_CTYPE
- 3) LANG
- Recall that a locale specification has the form
- language_COUNTRY.charset
-
- I'm using LANG and have it set like this
- sv_SE.ISO8859-1 I also have it sometimes set like this
- sv_SE.ascii
-
- const char* get_locale_charset (void)
- the function returns the 'codepage' that the current user is using
- (well you get the idea :-)
-
- 2) a function called iconv_string
- This C function converts an entire string from one encoding to another,
- using iconv. Easier to use than iconv() itself, and supports autodetect
- encodings on input.
-
- int iconv_string (const char* tocode, const char* fromcode,
- const char* start, const char* end,
- char** resultp, size_t* lengthp)
-
- Converts a memory region given in encoding FROMCODE to a new memory
- region in encoding TOCODE. FROMCODE and TOCODE are as for iconv_open(3),
- except that FROMCODE may be one of the values
- "autodetect_utf8" supports ISO-8859-1 and UTF-8
- "autodetect_jp" supports EUC-JP, ISO-2022-JP-2 and SHIFT_JIS
- "autodetect_kr" supports EUC-KR and ISO-2022-KR
- The input is in the memory region between start (inclusive) and end
- (exclusive). If resultp is not NULL, the output string is stored in
- *resultp; malloc/realloc is used to allocate the result.
-
- This function does not treat zero characters specially.
-
- Return value: 0 if successful, otherwise -1 and errno set. Particular
- errno values: EILSEQ and ENOMEM.
-
- Example:
- const char* s = ...;
- char* result = NULL;
- if (iconv_string("UCS-4-INTERNAL", "autodetect_utf8",
- s, s+strlen(s)+1, &result, NULL) < 0)
- perror("iconv_string");
-
- Jan-Erik Karlsson
- trg@privat.utfors.se